Converting the content of <div> Tag To An Image [closed]

Posted by ruhit on Stack Overflow See other posts from Stack Overflow or by ruhit
Published on 2010-12-21T11:30:25Z Indexed on 2010/12/28 10:54 UTC
Read the original article Hit count: 215

Filed under:

how to convert the content of tag into image fomat in php, please someone help me,I realy need it....... i have made this application...

<?php

        if(!isset($_GET['text']))
        {
        die("No text provided");
        }
        header ("Content-type: image/png");
        $text = $_GET['text'] ;
        $path="C:\wamp\www\image";
        $bg = imagecreatetruecolor(350, 75);
        //This will make it transparent
        imagesavealpha($bg, true);

        $trans_colour = imagecolorallocatealpha($bg, 0, 0, 0, 127);
        imagefill($bg, 0, 0, $trans_colour);

        $white = imagecolorallocate($bg, 255, 255, 255);
        $grey = imagecolorallocate($bg, 128, 128, 128);
        $black = imagecolorallocate($bg, 0,0,0);
        $background_color = imagecolorallocate ($bg, 25, 25, 25);
        $font = 'arial.ttf'; 
        $fontsize = 20; 
        imagettftext($bg, $fontsize, 0, 20, 20, $grey, $font, $text);
        //Create image
        imagepng($bg);
        imagepng($bg,"$path/img.png");
        //destroy image
        ImageDestroy($bg);

?>

and the image source is

<img src="img.php?text=helloworld">

now I want the text input from a tag field, so how to do this?Please help me..

© Stack Overflow or respective owner